#ifndef __IR_H__
#define __IR_H__

#include <stdint.h>
#include "Motor.h"

//红外遥控按键定义
#define IR_POWER		0x45
#define IR_MODE			0x46
#define IR_MUTE			0x47
#define IR_START_STOP	0x44
#define IR_PREVIOUS		0x40
#define IR_NEXT			0x43
#define IR_EQ			0x07
#define IR_VOL_MINUS	0x15
#define IR_VOL_ADD		0x09
#define IR_0			0x16
#define IR_RPT			0x19
#define IR_USD			0x0D
#define IR_1			0x0C
#define IR_2			0x18
#define IR_3			0x5E
#define IR_4			0x08
#define IR_5			0x1C
#define IR_6			0x5A
#define IR_7			0x42
#define IR_8			0x52
#define IR_9			0x4A

#define IR_RX_FLAG		0x01
#define IR_REPEAT_FLAG	0x02
#define IR_CTRCAR_FLAG	0x03

extern uint8_t IR_Command;
extern uint8_t IR_Address;

typedef struct{
	uint8_t IR_RxDataFlag;
	uint8_t IR_RepeatFlag;
	uint8_t IR_CtrCarFlag;
}IR_Flag;

void IR_Init(void);
/*这两个代码，不能正确的获取到地址和命令，暂时可以先用上面的IR_Command和IR_Address（前提是IR_Command的值未被清零，详情查看此.C文件）*/
uint8_t IR_GetAddress(void);
uint8_t IR_GetCommand(void);

uint8_t IR_GetFlag(uint8_t Flag);
void IR_Prepare(void);
void IR_CtrMasterCar(SetMotor_Speed* IR_Speed);

#endif
